package uk.ac.ebi.bioinvindex.model.impl.term;

import org.hibernate.search.annotations.Indexed;

import javax.persistence.*;
import java.util.Collection;

/**
 * User: Nataliya Sklyar (nsklyar@ebi.ac.uk)
 * Date: Jul 12, 2007
 */

@Entity
@Table(name = "design")
@Indexed(index = "bii")
public class DesignImpl extends FreeTextTermImpl{

	public DesignImpl() {
	}

	public DesignImpl(String name) {
		super(name);
	}

	public DesignImpl(String acc, String name) {
		super(acc, name);
	}

	@OneToMany(
			targetEntity = OntologyTermImpl.class
	)
	@JoinTable(
			name = "Design2OT",
			joinColumns = {@JoinColumn(name = "DESIGN_ID")},
			inverseJoinColumns = @JoinColumn(name = "OT_ID")
	)
	public Collection<OntologyTermImpl> getOntologyTerms() {
		return super.getOntologyTerms();
	}

	public String toString() {
		return "Design{" +
				"id=" + getId() + '\'' +
				"acc='" + getAcc() + '\'' +
				"name='" + value + '\'' +
				", ontologyTerms=" + ontologyTerms +
				'}';
	}
}
